import { t } from 'i18next'
import { useGlobalStore } from '@/store/global'
import {
	IconAi,
	IconBroadcast,
	IconChairmanPoll,
	IconDataMeeting,
	IconFileManage,
	IconMeetingPoll,
	IconMeetingVideo,
	IconMix,
	IconMonitor,
	IconMsg,
	IconMtAdd,
	IconMtAddAll,
	IconMtBatchDelete,
	IconMtBatchOffline,
	IconMtRecord,
	IconMtSelect,
	IconMtVmp,
	IconMute,
	IconRecall,
	IconRollcall,
	IconSilence,
	IconTvwall,
	IconUpload,
	IconVideoLive,
	IconVip,
	IconVmp,
	IconVoiceInspire,
	StyledItem,
	IconDelayMeeting,
	IconDeleteMeeting,
	IconSettingMeeting,
	StyledBtn,
	StyledNoItem,
	IconInfo,
	IconToggle,
	Wrap,
} from './style'
import { useMccStore } from '../../store'
import shallow from 'zustand/shallow'
import { useEffect, useState, useRef, forwardRef } from 'react'
import {
	fetchCallAllOfflineMt,
	fetchAllMute,
	fetchCancelAllMute,
	fetchCancelAllSilence,
	fetchAllSilence,
	fetchForceMute,
} from '@/api/manager/actions'
import { useTableAllStore } from '../main/table/all/store'
import { getCurrentTabType, useParamsStore, paramsRx } from '../main/store'
import { useMonitorStore } from '../monitor/store'
import { useSmsStore } from '../sms/store'
import { fetchForceBroadcast } from '@/api/manager/actions'
import Alert, { confirmModal } from '@/components/Alert'
import { fetchGetPlatformServiceUrl, fetchSetCookie } from '@/api/global'
import { usePollStore } from '../poll/store'
import { useTvWallStore } from '../tvwall//store'
import { init as addMtInit, mccAddMt } from '@/components/AddMt/store.trans'
import { useSettingMeetingStore } from '../meetingInfoSet/store'
import { fetchEndMeeting } from '@/api/meetingList'
import { fetchEndSubconf, fetchSubMeeting } from '@/api/manager/main'
import { Button, Modal, OverLayExtraProps, Space, TriggerInstance } from '@kedacom/react-next'
import { useAIStore } from '../ai/store'
import useLock from '@/hooks/useLock'
import { fetchCancelDcs, fetchOpenDcs } from '@/api/manager/dcs'
import { useVoiceInspireStore } from '../voiceInspire/store'
import { useTableDcsStore } from '../main/table/dcs/store'
import { usePlayVideoStore } from '../playVideo/store'
import { getItemInTree, isCascadeTree } from '../main/table/all/utils'
import { useTableOftenStore } from '../main/table/often/store'
import { Mt, revert_mt } from '@/api/manager/mt'
import { Trigger } from '@kedacom/react-next'
import { useVmpTypeStore } from '../vmp/store.get'
import { useVmpStore } from '../vmp/store'
import { useManagerStore } from '../main/manager/store'
import { useMtVmpStore } from '../mtVmp/store'
import VmpPopUp from '../vmp/VmpPopUp'
import { MEETING_JUMP_URL } from '@/utils/constant'
import { fetchGetAllTvwallStyles } from '@/api/manager/tvwall'
import { BoxInfoEntity } from '@/api/manager/tvwall/interface'
type PopUpProps = {
	force_mute: 0 | 1
} & OverLayExtraProps
export function MenuMtAdd() {
	return (
		<StyledItem
			onClick={() => {
				addMtInit({
					maxRate: useMccStore.getState().mccInfo.meetingRate,
					isSuperMeeting: useMccStore.getState().mccInfo.superMtNum ? true : false,
					curTemplateE164: useMccStore.getState().mccInfo.e164 || '',
					meetingType: useMccStore.getState().mccInfo.meetingType,
					isSupportRtc: !!useMccStore.getState().mccInfo.enableRtc,
					isMcc: true,
					meetingMoid: useMccStore.getState().mccInfo.meetingMoid,
					mccModel: useTableAllStore.getState().tree ?? {},
					smartCascadeMode: useMccStore.getState().mccInfo.smartCascadeMode,
					selectedEntityMts: [],
					isOpen: true,
					onSubmit: ({ selectedList, smcuMtid }) => {
						console.log('selectedList', selectedList, 'smcuMtid', smcuMtid)
						mccAddMt(selectedList, smcuMtid)
					},
				})
			}}
		>
			<IconMtAdd />
			<div className="text" title={t('邀请终端')}>
				{t('邀请终端')}
			</div>
		</StyledItem>
	)
}
export function MenuMtAddAll() {
	const meetingMoid = useMccStore((state) => state.mccInfo.meetingMoid)
	return (
		<StyledItem
			onClick={() => {
				const tab = getCurrentTabType()
				let url = ''
				if (tab === 'dcs') {
					url = `/mcc/${meetingMoid}/dcs/mts/online/all`
				} else {
					url = `/mcc/${meetingMoid}/online_mts/all`
				}
				fetchCallAllOfflineMt(url)
				paramsRx.tableCalling$.next()
			}}
		>
			<IconMtAddAll />
			<div className="text" title={t('呼叫全部离线')}>
				{t('呼叫全部离线')}
			</div>
		</StyledItem>
	)
}
export function MenuVip() {
	return (
		<StyledItem
			className="vip"
			onClick={() => {
				useMccStore.getState().setCurPage('vip')
				useParamsStore.getState().showActionButton()
			}}
		>
			<IconVip />
			<div className="text" title={t('VIP设置')}>
				{t('VIP设置')}
			</div>
		</StyledItem>
	)
}
export function MenuMute() {
	const ref = useRef<TriggerInstance>(null)
	const on = useMccStore((state) => state.mccInfo.mute)
	const force_mute = useMccStore((state) => state.mccInfo.force_mute)
	const meetingMoid = useMccStore((state) => state.mccInfo.meetingMoid)
	const handleClick = useLock(async () => {
		on ? fetchCancelAllMute(meetingMoid) : fetchAllMute(meetingMoid, force_mute)
	}, 5000)

	const MutePopUp = forwardRef((props: PopUpProps, ref: any) => {
		const { force_mute, ...restProps } = props
		const meetingType = useMccStore((state) => state.mccInfo.meetingType)
		const handleMute = (v: 0 | 1) => {
			const meeting_moid = useMccStore.getState().mccInfo.meetingMoid
			fetchForceMute(meeting_moid, { value: v })
		}
		return meetingType !== 2 ? (
			<Wrap ref={ref} {...restProps}>
				<div className="line" onClick={() => handleMute(1)}>
					<span className="img">{!!force_mute && <IconToggle className="icon"></IconToggle>}</span>

					<span>{t('禁止与会方自己解除哑音')}</span>
				</div>
				<div className="line" onClick={() => handleMute(0)}>
					<span className="img">{!force_mute && <IconToggle className="icon"></IconToggle>}</span>

					<span>{t('允许与会方自己解除哑音')}</span>
				</div>
			</Wrap>
		) : (
			<></>
		)
	})
	return (
		<Trigger popup={<MutePopUp force_mute={force_mute} />} ref={ref} trigger="hover">
			<StyledItem
				onClick={() => {
					handleClick()
				}}
			>
				<IconMute on={on} />
				<div className="text" title={on ? t('取消全场哑音') : t('全场哑音')}>
					{on ? t('取消全场哑音') : t('全场哑音')}
				</div>
			</StyledItem>
		</Trigger>
	)
}
export function MenuSilence() {
	const on = useMccStore((state) => state.mccInfo.silence)
	const meetingMoid = useMccStore((state) => state.mccInfo.meetingMoid)
	const handleClick = useLock(async () => {
		on ? fetchCancelAllSilence(meetingMoid) : fetchAllSilence(meetingMoid)
	}, 5000)
	return (
		<StyledItem
			onClick={() => {
				handleClick()
			}}
		>
			<IconSilence on={on} />
			<div className="text" title={on ? t('取消全场静音') : t('全场静音')}>
				{on ? t('取消全场静音') : t('全场静音')}
			</div>
		</StyledItem>
	)
}
export function MenuMtSelect() {
	return (
		<StyledItem
			className="select"
			onClick={() => {
				useMccStore.getState().setCurPage('mt_select')
			}}
		>
			<IconMtSelect />
			<div className="text" title={t('终端选看')}>
				{t('终端选看')}
			</div>
		</StyledItem>
	)
}
export function MenuVmp() {
	const meetingType = useMccStore((state) => state.mccInfo.meetingType)
	const vmpState = useMccStore((state) => state.mccInfo.vmpState)
	const ref = useRef<TriggerInstance>(null)
	const handleClick = () => {
		useVmpTypeStore.setState({ type: 'vmp' })
		useVmpStore.setState({
			isOpen: true,
			isShowPlanOperateModal: false,
			onClose: () => {
				useMccStore.getState().setCurPage('mcc_main')
			},
		})
		useMccStore.getState().setCurPage('vmp')
	}
	const PopUpPanel = (
		<VmpPopUp
			type="vmp"
			editVmp={handleClick}
			closePannel={() => {
				ref.current?.close()
			}}
		/>
	)

	return (
		<Trigger popup={PopUpPanel} trigger="hover" ref={ref}>
			<StyledItem onClick={handleClick}>
				<IconVmp className={vmpState ? 'on' : ''} />
				<div className="text" title={meetingType === 2 ? t('定制画面合成') : t('会议画面合成')}>
					{meetingType === 2 ? t('定制画面合成') : t('会议画面合成')}
				</div>
			</StyledItem>
		</Trigger>
	)
}
export function MenuMtVmp() {
	const ref = useRef<TriggerInstance>(null)
	const chairmanMtVmpState = useMccStore((state) => state.mccInfo.chairmanMtVmpState)
	const handleMtVMP = () => {
		const chairman = useManagerStore.getState().chairman
		if (chairman && chairman.mtKey) {
			const tableAll = useTableAllStore.getState().tree
			const batchMembers: Mt[] = []
			getItemInTree(tableAll, (item) => {
				if (
					item.mcc.confLevel === 2 &&
					item.mcc.isMt &&
					item.mcc.status.isOnline &&
					item.mcc.mtType !== 7 &&
					item.mcc.mtType !== 9
				) {
					batchMembers.push(new Mt(revert_mt(item.mcc)))
				}
			})
			useVmpTypeStore.setState({ type: `mtVmp_${chairman.mtKey}` })
			useMtVmpStore.setState({
				isOpen: true,
				isShowPlanOperateModal: false,
				batchMembers,
				mt_info: chairman,
				onClose: () => {
					useMccStore.getState().setCurPage('mcc_main')
				},
			})
			useMccStore.getState().setCurPage('mtvmp')
		} else {
			Alert(t('请设置当前会议管理方。'))
		}
	}
	const PopUpPanel = (
		<VmpPopUp
			type="mtVmp"
			closePannel={() => {
				ref.current?.close()
			}}
			editVmp={handleMtVMP}
		/>
	)

	return (
		<Trigger popup={PopUpPanel} trigger="hover" ref={ref}>
			<StyledItem onClick={handleMtVMP}>
				<IconMtVmp className={chairmanMtVmpState ? 'on' : ''} />
				<div className="text" title={t('管理方画面合成')}>
					{t('管理方画面合成')}
				</div>
			</StyledItem>
		</Trigger>
	)
}
export function MenuMix() {
	return (
		<StyledItem
			className="mix"
			onClick={() => {
				useMccStore.getState().setCurPage('mix')
			}}
		>
			<IconMix />
			<div className="text" title={t('混音')}>
				{t('混音')}
			</div>
		</StyledItem>
	)
}
export function MenuTvwall() {
	return (
		<StyledItem
			onClick={async () => {
				const res = await fetchGetAllTvwallStyles()
				if (res.success) {
					if (res.data && res.data.length > 0) {
						let _result: { [key: string]: BoxInfoEntity } = {}
						for (var i = 0; i < res.data.length; i++) {
							const current = res.data[i]
							_result[current.id] = current
						}
						const tableAll = useTableAllStore.getState().tree
						const isCascade = isCascadeTree(tableAll)
						const batchMembers: Mt[] = []
						getItemInTree(tableAll, (item) => {
							if (
								item.mcc.confLevel === 2 &&
								item.mcc.isMt &&
								item.mcc.status.isOnline &&
								item.mcc.mtType !== 7 &&
								item.mcc.mtType !== 9
							) {
								batchMembers.push(item.mcc)
							}
						})

						useTvWallStore.setState({
							isOpen: true,
							style_map: _result,
							isCascade: isCascade,
							oftenMembers: useTableOftenStore.getState().list.map((item) => item.mcc),
							batchMembers: batchMembers,
							onInit: () => {
								// TS.mcc.nowPage = 'mcc_tvwall'
								useMccStore.getState().setCurPage('tvwall')
								// TS.mcc.info.isUp = true
								// window.TS.mcc.monitor.controller.hideObj() //隐藏会议监控
							},
							onClose: () => {
								// window.TS.mcc.monitor.controller.showObj()
								// TS.mcc.nowPage = 'mcc_main'
								useMccStore.getState().setCurPage('mcc_main')
							},
						})
					} else {
						Alert(t('尚未配置任何电视墙风格，请联系管理员'))
					}
				} else {
					Alert(res.description || '')
				}
			}}
		>
			<IconTvwall />
			<div className="text" title={t('电视墙')}>
				{t('电视墙')}
			</div>
		</StyledItem>
	)
}
export function MenuMeetingPoll() {
	return (
		<StyledItem
			className="meeting-poll"
			onClick={() => {
				useMccStore.getState().setCurPage('meeting_poll')
				useParamsStore.getState().showActionButton()
				usePollStore.getState().update({ poll_mode: 1 })
			}}
		>
			<IconMeetingPoll />
			<div className="text" title={t('会议轮询')}>
				{t('会议轮询')}
			</div>
		</StyledItem>
	)
}
export function MenuChairmanPoll() {
	return (
		<StyledItem
			className="chairman-poll"
			onClick={() => {
				useMccStore.getState().setCurPage('chairman_poll')
				useParamsStore.getState().showActionButton()
				usePollStore.getState().update({ poll_mode: 2 })
			}}
		>
			<IconChairmanPoll />
			<div className="text" title={t('管理方轮询')}>
				{t('管理方轮询')}
			</div>
		</StyledItem>
	)
}
export function MenuRollcall() {
	return (
		<StyledItem
			className="roll-call"
			onClick={() => {
				//纯转发会议无法开启点名
				if (useMccStore.getState().mccInfo.preoccupy_resource === 2) {
					Alert(t('纯转发会议，无法开启点名功能'))
					return
				}
				useMccStore.getState().setCurPage('rollcall')
				useParamsStore.getState().showActionButton()
			}}
		>
			<IconRollcall />
			<div className="text" title={t('点名轮询')}>
				{t('点名轮询')}
			</div>
		</StyledItem>
	)
}
export function MenuMtBatchDelete() {
	return (
		<StyledItem
			className="mt-batch-delete"
			onClick={() => {
				useParamsStore.getState().showActionButton('deleteAllMt')
			}}
		>
			<IconMtBatchDelete />
			<div className="text" title={t('批量删除终端')}>
				{t('批量删除终端')}
			</div>
		</StyledItem>
	)
}
export function MenuVideoLive() {
	const { user, SWITCH } = useGlobalStore((state) => ({ user: state.user, SWITCH: state.SWITCH }), shallow)
	const mccInfo = useMccStore((state) => state.mccInfo)
	const [title, setTitle] = useState(t('录像与直播'))
	useEffect(() => {
		if (user) {
			if (user.enable_live && SWITCH.vrs.live && (!SWITCH.vrs.video || !user.enable_video)) {
				//有直播无录像权限

				setTitle(t('会议直播'))
			} else if ((!user.enable_live || !SWITCH.vrs.live) && SWITCH.vrs.video && user.enable_video) {
				setTitle(t('会议录像'))
			}
		}
	}, [user, mccInfo, SWITCH])
	return (
		<StyledItem
			className="video-live"
			onClick={() => {
				useMccStore.getState().setCurPage('video_live')
			}}
		>
			<IconVideoLive />
			<div className="text" title={title}>
				{title}
			</div>
		</StyledItem>
	)
}
export function MenuMeetingVideo() {
	return (
		<StyledItem
			className="meeting-video"
			onClick={() => {
				useMccStore.getState().setCurPage('meeting_video')
			}}
		>
			<IconMeetingVideo />
			<div className="text" title={t('会议放像')}>
				{t('会议放像')}
			</div>
		</StyledItem>
	)
}
export function MenuMtBatchOffline() {
	return (
		<StyledItem
			className="mt-batch-offline"
			onClick={() => {
				useMccStore.getState().setCurPage('mcc_main')
				useParamsStore.getState().showActionButton('hangUpAllMt')
			}}
		>
			<IconMtBatchOffline />
			<div className="text" title={t('批量挂断终端')}>
				{t('批量挂断终端')}
			</div>
		</StyledItem>
	)
}
export function MenuMsg() {
	return (
		<StyledItem
			className="msg"
			onClick={() => {
				useMccStore.getState().setCurPage('msg')
				if (useSmsStore.getState().receiVTerminal === 2) {
					useParamsStore.getState().showActionButton()
				}
			}}
		>
			<IconMsg />
			<div className="text" title={t('短消息')}>
				{t('短消息')}
			</div>
		</StyledItem>
	)
}
export function MenuBroadcast() {
	const force_brd = useMccStore((state) => state.mccInfo.force_brd)
	return (
		<StyledItem
			className="broadcast"
			onClick={() => {
				useMccStore.getState().setCurPage('mcc_main')
				fetchForceBroadcast(useMccStore.getState().mccInfo.meetingMoid, force_brd)
			}}
		>
			<IconBroadcast className={force_brd ? 'on' : ''} />
			<div className="text" title={force_brd ? t('关闭强制广播') : t('开启强制广播')}>
				{force_brd ? t('关闭强制广播') : t('开启强制广播')}
			</div>
		</StyledItem>
	)
}
export function MenuVoiceInspire() {
	return (
		<StyledItem
			className="voice-inspire"
			onClick={() => {
				let mixMode = useMccStore.getState().mixMode
				if (mixMode === 2) {
					Alert(t('您无法同时开启定制混音功能和语音激励功能'))
					return
				}
				if (usePlayVideoStore.getState().info.state !== 0) {
					Alert(t('您无法同时开启会议放像功能和语音激励功能'))
					return
				}
				useVoiceInspireStore.setState({ isOpen: true })
			}}
		>
			<IconVoiceInspire />
			<div className="text" title={t('语音激励')}>
				{t('语音激励')}
			</div>
		</StyledItem>
	)
}
export function MenuRecall() {
	return (
		<StyledItem>
			<IconRecall
				className="recall"
				onClick={() => {
					useMccStore.getState().setCurPage('recall')
					useParamsStore.getState().showActionButton()
				}}
			/>
			<div className="text" title={t('追呼设置')}>
				{t('追呼设置')}
			</div>
		</StyledItem>
	)
}
export function MenuFileManage() {
	return (
		<StyledItem
			className="file-manager"
			onClick={() => {
				let meetingMoid = useMccStore.getState().mccInfo.meetingMoid
				fetchSetCookie(
					{
						meeting_moid: meetingMoid,
						type: 1,
					},
					() => {
						window.open(MEETING_JUMP_URL + `/meeting/meetingSpace/${meetingMoid}`)
					}
				)
			}}
		>
			<IconFileManage />
			<div className="text" title={t('会议空间')}>
				{t('会议空间')}
			</div>
		</StyledItem>
	)
}
export function MenuUpload() {
	return (
		<StyledItem
			className="upload"
			onClick={() => {
				useMccStore.getState().setCurPage('upload')
				useParamsStore.getState().showActionButton()
				usePollStore.getState().update({ poll_mode: 3 })
			}}
		>
			<IconUpload />
			<div className="text" title={t('上传轮询')}>
				{t('上传轮询')}
			</div>
		</StyledItem>
	)
}
export function MenuMtRecord() {
	return (
		<StyledItem
			className="mt-record"
			onClick={() => {
				useMccStore.getState().setCurPage('mt_record')
				useParamsStore.getState().showActionButton('mtVideo')
			}}
		>
			<IconMtRecord />
			<div className="text" title={t('终端录像')}>
				{t('终端录像')}
			</div>
		</StyledItem>
	)
}
export function MenuDataMeeting() {
	const isDcs = useTableDcsStore((state) => state.isDcs)
	const meetingMoid = useMccStore((state) => state.mccInfo.meetingMoid)

	const handleClick = useLock(async () => {
		const res = await (isDcs ? fetchCancelDcs(meetingMoid) : fetchOpenDcs(meetingMoid))
		if (!res.success) {
			isDcs ? Alert(t('关闭数据会议失败')) : Alert(t('开启数据会议失败'))
		}
	}, 5000)
	return (
		<StyledItem className="data-meeting" onClick={handleClick}>
			<IconDataMeeting className={isDcs ? 'on' : ''} />
			<div className="text" title={isDcs ? t('关闭数据协作') : t('开启数据协作')}>
				{isDcs ? t('关闭数据协作') : t('开启数据协作')}
			</div>
		</StyledItem>
	)
}
export function MenuMonitor() {
	return (
		<StyledItem
			className="monitor"
			onClick={() => {
				if (!useMonitorStore.getState().appCheckHasReadyAndStart()) {
					return
				}
				//更新
				if (useMonitorStore.getState().NeedMustUpdateExeVersion) {
					useMonitorStore.getState().showUpdateDialog(false)
					return
				}
				useMonitorStore.getState().webToNativeEntry('ShowMonitor')
			}}
		>
			<IconMonitor />
			<div className="text" title={t('会议监控')}>
				{t('会议监控')}
			</div>
		</StyledItem>
	)
}
export function MenuAi() {
	return (
		<StyledItem
			className="ai"
			onClick={() => {
				useMccStore.getState().setCurPage('ai')
				setTimeout(() => {
					useAIStore.setState({ isOpen: true })
				}, 0)
			}}
		>
			<IconAi />
			<div className="text" title={'AI'}>
				AI
			</div>
		</StyledItem>
	)
}
export function MenuSettingMeeting() {
	return (
		<StyledItem
			onClick={() => {
				useSettingMeetingStore.getState().fetchInit()
			}}
		>
			<IconSettingMeeting />
			<div className="text" title={t('会议信息设置', { context: 'SC1' })}>
				{t('会议信息设置', { context: 'SC1' })}
			</div>
		</StyledItem>
	)
}
export function MenuDelayMeeting() {
	const duration = useMccStore.getState().mccInfo.duration
	return (
		<StyledItem
			className={duration === 0 ? 'disable' : ''}
			onClick={() => {
				duration !== 0 && useSettingMeetingStore.getState().initDelayMeeting({ from: 0 })
			}}
		>
			<IconDelayMeeting duration={duration} />
			<div className="text" title={t('延长会议')}>
				{t('延长会议')}
			</div>
		</StyledItem>
	)
}
export function MenuEndMeeting() {
	const handleClick = () => {
		const { subject, smartCascadeMode, meetingMoid } = useMccStore.getState().mccInfo
		if (smartCascadeMode !== 0) {
			handleEndMeeting(meetingMoid, subject)
		} else {
			handleCascadeMeeting(meetingMoid, subject)
		}
	}
	const handleEndMeeting = (meetingMoid: string, subject: string) => {
		confirmModal({
			msg: t('结束会议{{name}}？', { name: subject }),
			okText: t('结束会议', { context: 'SC1' }),
			onOk: () => {
				fetchEndMeeting(meetingMoid, 0).then((res) => {
					if (!res.success) {
						Alert(res.description || t('结束会议操作失败'))
					}
				})
			},
		})
	}
	const handleEndLowLevelMeeting = (meetingMoid: string, subject: string) => {
		fetchEndSubconf(meetingMoid).then((res) => {
			if (!res.success) Alert(res.description)
		})
	}
	const handleCascadeMeeting = useLock(async (meetingMoid: string, subject: string) => {
		const res = await fetchSubMeeting(meetingMoid)
		if (res.success) {
			if (res.data && res.data.level_meeting) {
				const m = Modal.alert({
					title: t('提示'),
					content: t('结束会议“{{name}}”并同时结束所属下级会议，还是仅结束此会议？', { name: subject }),
					footer: (
						<StyledBtn>
							<Space>
								<Button
									onClick={() => {
										m.hide()
										handleEndLowLevelMeeting(meetingMoid, subject)
									}}
								>
									{t('同时结束下级会议')}
								</Button>
								<Button
									onClick={() => {
										m.hide()
										fetchEndMeeting(meetingMoid, 0).then((res) => {
											if (!res.success) {
												Alert(res.description || t('结束会议操作失败'))
											}
										})
									}}
								>
									{t('仅结束此会议')}
								</Button>
								<Button
									onClick={() => {
										m.hide()
									}}
								>
									{t('取消')}
								</Button>
							</Space>
						</StyledBtn>
					),
					onCancel: () => {
						m.hide()
					},
					okText: t('确定'),
					cancelText: '',
				})
			} else {
				handleEndMeeting(meetingMoid, subject)
			}
		}
	}, 3000)
	return (
		<StyledItem
			onClick={() => {
				handleClick()
			}}
		>
			<IconDeleteMeeting />
			<div>{t('结束会议', { context: 'SC1' })}</div>
		</StyledItem>
	)
}

export function MenuNoItemTip() {
	return (
		<StyledNoItem>
			<IconInfo></IconInfo>
			<span className="tips">{t('没有设置常用功能')}</span>
			<div
				className="link"
				onClick={() => {
					//跳转到个性化界面
					fetchGetPlatformServiceUrl()
						.then((data) => {
							window.location.href = data + '/personalConfig.html?tab=mcc_operate'
						})
						.catch((err) => {
							window.location.href = '/meeting/personalConfig.html?tab=mcc_operate'
						})
				}}
			>
				{t('设置会控常用操作')}
			</div>
		</StyledNoItem>
	)
}
